package cn.yto.print.controller.rest;

import cn.yto.print.config.WeightLinkedContext;
import com.google.common.collect.Maps;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/status")
@CrossOrigin(origins = "*")
public class WeightStatusController {

    @GetMapping("/wms")
    public Map<String, Integer> getWmsStatus() {
        Map<String, Integer> wmsStatus = Maps.newHashMap();
        wmsStatus.put("wmsStatus", WeightLinkedContext.getWmsConnectStatus());
        return wmsStatus;
    }

    @GetMapping("/client")
    public Map<String, Integer> getClientStatus() {
        Map<String, Integer> clientStatus = Maps.newHashMap();
        clientStatus.put("clientStatus", WeightLinkedContext.getDeviceConnectStatus());
        return clientStatus;
    }

}
